home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Mac / Lib / test / progressbar.py < prev    next >
Encoding:
Python Source  |  2000-06-23  |  470 b   |  26 lines

  1. # Progress dialog
  2.  
  3. from Dlg import GetNewDialog, ModalDialog, SetDialogItemText
  4.  
  5. count = 0
  6.  
  7. def filter(d, e):
  8.     r = 1
  9.     print "Filter(%s, %s) -> %s" % (`d`, `e`, `r`)
  10.     return r
  11.  
  12. def main():
  13.     d = GetNewDialog(256, -1)
  14.     tp, h, rect = d.GetDialogItem(2)
  15.     SetDialogItemText(h, "Progress...")
  16.     for i in range(100):
  17.         if i%10 == 0:
  18.             str = "Progress...%d" % i
  19.             SetDialogItemText(h, str)
  20.             ModalDialog(filter)
  21.         for j in range(100): pass
  22.  
  23. if __name__ == '__main__':
  24.     main()
  25.  
  26.